from time import sleep

from Aspects import Logger
from AOPy import weave,getPointcutter

@weave
def p(*args,**kwargs):
    print "|",args, kwargs,"|"
    
@weave
def d(*args,**kwargs):
    print "\t|",args, kwargs,"|"
    
logger = Logger("p", "1", ["0"])
getPointcutter().addPointcuter(logger)

def run():
    global logger
    while True:
        try:
            
            print "_"*30
            p(15)
            print
            p(1,2,a=1,b=1)
            print
            d()
            print
            d(1)
            print 
            sleep(1)
        except KeyboardInterrupt:
            val = raw_input("\nEnter a new pointcut: ").split()
            try:
                logger.setPointcut(val[0],val[1],val[2:])
            except:
                print "invalid pointcut"
    
run()